import { Db, Collection, FindOptions, OptionalId } from "mongodb"

interface Haiku {
  title: string
  content: string
}

export default class Movies {
  private haiku: Collection<Haiku>
  constructor(database: Db) {
    this.haiku = database.collection<Haiku>("haiku")
  }

  async insertOne(filter: OptionalId<Haiku>) {
    const result = await this.haiku.insertOne(filter)
    console.log(`A document was inserted with the _id: ${result.insertedId}`)
  }

  async insertMany(filter: OptionalId<Haiku>[]) {
    const result = await this.haiku.insertMany(filter)
    console.log(`${result.insertedCount} documents were inserted`)
  }
}